package com.tianhui.consignortwofei.other.auth.recognition.process;

import com.baidu.ocr.sdk.model.BankCardResult;
import com.tianhui.consignortwofei.mvp.model.enty.RecognitionInfo;
import com.tianhui.consignortwofei.mvp.model.enty.SelectPhotoInfo;
import com.tianhui.consignortwofei.mvp.model.enty.bankCard.BankCardInfo;
import com.tianhui.consignortwofei.other.auth.inte.ProcessCallback;
import com.tianhui.consignortwofei.other.auth.recognition.recognitionResultProcess.BankCardOcrResultProcess;

/**
 * @author fgs
 * @date 2021/5/17
 * @description
 **/
public class BankCardRecognitionProcess implements IRecognitionProcess<BankCardResult, BankCardInfo> {
    @Override
    public void recognitionProcess(RecognitionInfo<BankCardResult> recognitionInfo, SelectPhotoInfo selectPhotoInfo, ProcessCallback<BankCardInfo> processCallback) {
        String errorMessage = "不是银行卡图片或图片太模糊，请重试";
        if (recognitionInfo != null && recognitionInfo.info != null) {
            BankCardResult bankCardResult = recognitionInfo.info;
            BankCardOcrResultProcess bankCardOcrResultProcess = new BankCardOcrResultProcess();
            BankCardInfo cardInfo = bankCardOcrResultProcess.getBankCardOcrResult(bankCardResult);
            processCallback.processSuccess(cardInfo);
        } else {
            processCallback.processSuccess(null);
//            processCallback.processFailed();
        }
    }
}
